package lan.battletank.element;

import lan.battletank.environment.EnvConst;
import android.graphics.Bitmap;
import android.graphics.Canvas;

public class BarricadeEntity extends BaseElement {

    /** The bounds position to draw. */
    public int bound_l = 0; // left
    public int bound_t = 0; // top
    public int bound_r = 0; // right
    public int bound_b = 0; // bottom

    private boolean mAlive = true;	// if the object is show on screen

    /** Constructor, initial all parameters here. */
    public BarricadeEntity() {
        width = EnvConst.BARRICADE_WIDTH;
        height = EnvConst.BARRICADE_HEIGHT;
        halfWidth = EnvConst.BARRICADE_WIDTH / 2;
        halfHeight = EnvConst.BARRICADE_HEIGHT / 2;
    }

    public void draw(Bitmap bmp, Canvas c) {
    	c.drawBitmap(bmp, bound_l, bound_t, null);
    }

    public void setPosition(int cX, int cY) {
    	centerX = cX;
        centerY = cY;
    	bound_l = cX - halfWidth;
    	bound_t = cY - halfHeight;
    	bound_r = cX + halfWidth;
    	bound_b = cY + halfHeight;
    }
    
    public void destroy() {
    	mAlive = false;
    }
    
    public boolean isAlive() {
    	return mAlive;
    }
}
